/**
 * 详情对话框
 */
var ToolExpressScanInfoDlg = {
    data: {
        state: "",
        waveId: "",
        orderNumber: "",
        userId: "",
        userName: "",
        v1: "",
        v2: ""
    }
};

layui.use(['form', 'admin', 'ax','laydate'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    //执行一个laydate实例
    laydate.render({
        elem: '#modified_begin' //指定元素
        ,value:new Date(),
        type:'datetime'
    });

    //执行一个laydate实例
    laydate.render({
        elem: '#modified_end' //指定元素
        ,value:new Date(),
        type:'datetime'
    });

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var msg;
        $.ajax({
            url:Feng.ctxPath + "/outOrder/getJSTOutOrder",
            data:data.field,
            cache: false,
            dataType:"json",
            beforeSend:function(){
                msg = layer.msg('拉取中。。。请耐心等待', {
                    icon: 16,
                    shade: [0.2,'#000'], //0.1透明度的白色背景
                    time: false
                });
            },
            success:function(data){
                layer.close(msg);
                if (data.success) {
                    if (data.message != null &&data.message != "" ) {
                        var msg2 =  layer.open({
                            title: '提示' ,
                            content: data.message,
                            btn: ['确定'],
                            yes: function (){
                                parent.submit = 1
                                window.location.href = Feng.ctxPath + '/outOrder'
                            }
                        });
                    } else {
                        parent.submit = 1
                        Feng.success("拉取成功!");
                        window.location.href = Feng.ctxPath + '/outOrder'
                    }
                } else {
                    Feng.error("操作失败！"+data.message);
                }
            },
            error:function(data){
                layer.close(msg);
                Feng.error("操作失败！" + data.responseJSON.message)
            }
        })

        return false;
    });

    //返回按钮
    $("#backupPage").click(function () {
        console.log(1111)
        window.location.href = Feng.ctxPath + '/outOrder'
    });

});